package com.chaopei.account_mng.controller;

import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author Corday 天涯
 * @Date 2022/5/12 15:21
 * 提供消息
 */
@RestController
@RequestMapping("/account")
public class MQController {
//    发送消息的工具
    @Resource
    private JmsMessagingTemplate jmsMessagingTemplate;

    /**
     * http://localhost:8084/account/send
     * @param msg
     * @return
     */
    @RequestMapping("/send")
    public String sendMessage(String msg){
//        参数(消息的标识,发送的消息)
        jmsMessagingTemplate.convertAndSend("tom.mq",msg);
        return "消息发送成功!";
    }
}
